// 公共的请求处理
const ErrorCodeData = {
	500:{
		code:500,
		data:null,
		errMsg:'系统异常'
	},
	401:{
		code:401,
		data:null,
		errMsg:'账号未登录'
	}
}


const responsSuccess = (data = '')=>{
	return {
		code:200,
		data,
		errMsg:''
	}
}

const responsError = (code,errMsg='',data=null)=>{
	const respons = ErrorCodeData[code]
	if(errMsg) respons.errMsg = errMsg
	if(data) respons.data = data
	return respons
}

module.exports = {
	responsSuccess,
	responsError
}